package net.luohuasheng.bee.proxy.mybatis.common.enums;


/**
 * @author luohuasheng
 */

public enum FillterType {
    NONE(0, "非字段条件"),
    START_WITH(1, "开始以"),
    NOT_START_WITH(2, "开始不是以"),
    CONTAIN(3, "包含"),
    NOT_CONTAIN(4, "不包含"),
    END_WITH(5, "结束以"),
    NOT_END_WITH(6, "结束以不是以"),
    BETWEEN(7, "介于"),
    NOT_BETWEEN(8, "非介于"),
    IS_BLANK(9, "空白的"),
    IS_NOT_BLANK(10, "非空白的"),
    EQUALS(11, "等于"),
    NOT_EQUALS(12, "不等于"),
    GREATER(13, "大于"),
    NOT_GREATER(14, "不大于"),
    LESS(15, "小于"),
    NOT_LESS(16, "不小于"),
    IS_NULL(17, "是null"),
    IS_NOT_NULL(18, "不是null"),
    IN(19, "列表内"),
    NOT_IN(20, "列表外"),
    EXISTS(21, "存在"),
    NOT_EXISTS(22, "不存在"),
    ;

    private Integer code;

    private String name;

    FillterType(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static FillterType getTypeByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (FillterType element : FillterType.values()) {
            if (element.getCode().equals(code)) {
                return element;
            }
        }
        return null;
    }


    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

}